﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmBuscarCliente.aspx.cs" Inherits="Farmacia.net.Ventas.Cliente.frmBuscarCliente" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style3
        {
            width: 100%;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>Buscar Cliente</h2>

<fieldset>
<legend>Criterio</legend>
    <table class="style3">
        <tr>
            <td style="text-align: right">
    <asp:Label ID="Label1" runat="server" Text="Ingrese Ruc o Dni:" 
        Font-Bold="True" ForeColor="Black" style="text-align: right"></asp:Label> 
            </td>
            <td>
    <asp:TextBox ID="txtBuscar" runat="server" Width="300px" ClientIDMode="Static"
        Height="19px" />
                <asp:ImageButton ID="btnBuscarimg" runat="server" Height="20px" 
                    ImageUrl="~/Images/1340835453_file_search.png" Width="20px" 
                    onclick="btnBuscarimg_Click" />
            </td>
            <td>
                &nbsp;</td>
            <td style="text-align: right">
                &nbsp;</td>
            <td style="text-align: right">
                <asp:ImageButton ID="btnNuevoCliente" runat="server" 
                    ImageUrl="~/Images/1340867130_add-user.png" style="text-align: right" 
                    PostBackUrl="frmRegistrarCliente.aspx?acc=nuevo" />
            </td>
        </tr>
        </table>
</fieldset>
<fieldset>
<legend>Listado Clientes</legend>
    <asp:Label ID="lblMensaje" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>

    <asp:GridView ID="GridView1" runat="server" CellPadding="4" 
        AutoGenerateColumns="False" DataSourceID="odsCliente" BorderWidth="1px" 
        BorderColor="Black" Width="100%" 
        AllowPaging="True" Height="221px" ForeColor="#333333" GridLines="None" 
        DataKeyNames="IdCliente" onrowcommand="GridView1_RowCommand" 
        BorderStyle="Solid">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField DataField="IdCliente" HeaderText="Id" SortExpression="IdCliente" >
            <ControlStyle BorderColor="#0000CC" BorderStyle="Dotted" BorderWidth="1px" 
                Width="50px" />
            <HeaderStyle BorderStyle="Inset" BorderWidth="1px" />
            <ItemStyle BorderStyle="Inset" BorderWidth="1px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="RucDni" HeaderText="RucDni" 
                SortExpression="RucDni" >
            <ControlStyle BorderWidth="1px" />
            <HeaderStyle BorderStyle="Inset" BorderWidth="1px" />
            <ItemStyle Width="90px" BorderStyle="Inset" BorderWidth="1px" 
                HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="RazonSocial" HeaderText="RazonSocial" 
                SortExpression="RazonSocial" >
            <HeaderStyle BorderStyle="Inset" BorderWidth="1px" />
            <ItemStyle Width="250px" BorderStyle="Inset" BorderWidth="1px" 
                HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Direccion" HeaderText="Direccion" 
                SortExpression="Direccion" >
            <HeaderStyle BorderStyle="Inset" BorderWidth="1px" HorizontalAlign="Center" />
            <ItemStyle Width="250px" BorderStyle="Inset" BorderWidth="1px" 
                HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="Telefono" HeaderText="Telefono" 
                SortExpression="Telefono" >
            <HeaderStyle BorderStyle="Inset" BorderWidth="1px" />
            <ItemStyle BorderStyle="Inset" BorderWidth="1px" HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:TemplateField FooterText="Editar">
                <ItemTemplate>
                    <asp:ImageButton ID="btnEditar" runat="server" Height="20px" 
                        ImageUrl="~/Images/1340864176_file_edit.png" Width="20px" 
                        
                        PostBackUrl='<%# Eval("IdCliente","frmRegistrarCliente.aspx?acc=editar&amp;idCliente={0}") %>' ToolTip="Editar" 
                                                 />
                </ItemTemplate>
                <HeaderStyle BorderStyle="Inset" BorderWidth="1px" />
                <ItemStyle BorderStyle="Inset" BorderWidth="1px" HorizontalAlign="Center" />
            </asp:TemplateField>
            <asp:TemplateField FooterText="Eliminar">
                <ItemTemplate>
                    <asp:ImageButton ID="ImgBtnQuitar" runat="server" Height="20px" 
                        ImageUrl="~/Images/1340849209_close.png" Width="20px" 
                        CommandName="eliminar" 
                        OnClientClick="confirm('Desea Eliminar el Cliente');" CausesValidation="False" 
                                                PostBackUrl='<%# Eval("IdCliente","frmRegistrarCliente.aspx?acc=eliminar&IdCliente={0}") %>' 
                                                
                        ToolTip="Eliminar" />
                </ItemTemplate>
                <HeaderStyle BorderStyle="Inset" BorderWidth="1px" />
                <ItemStyle BorderStyle="Inset" BorderWidth="1px" HorizontalAlign="Center" />
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:ObjectDataSource ID="odsCliente" runat="server" 
        SelectMethod="GetFromClienteByRazonSocialAndRucDni" 
        TypeName="Farmacia.BussinessLogic.ClienteBL" 
        onobjectcreating="odsCliente_ObjectCreating" 
        ondeleted="odsCliente_Deleted">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtBuscar" DefaultValue="%" Name="criterio" 
                PropertyName="Text" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    </fieldset>
</asp:Content>

